#define  _CRT_SECURE_NO_WARNINGS  1
#include <stdio.h>
#include <math.h>
int fun(int n)
{
	int len = log10(n) + 1;
	int i = 0;
	int s = 0, a = 0, b = n;
	for (i = 0; i < len; i++)
	{
		a = n % 10;
		n = n / 10;
		s = s + pow(a, len);
	}
	if (b == s)
		return 1;
	else
		return 0;
}
int main()
{
	int i = 0;
	for (i = 1; i <= 100000; i++)
	{
		if (fun(i))
			printf("%d ", i);
	}


	return 0;
}